home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 142
/
Volume 142 Oct 17 2011 - Damaged.iso
/
Games
/
maya-ball.swf
/
scripts
/
__Packages
/
bonus.as
< prev
next >
Wrap
Text File
|
2011-10-17
|
8KB
|
196 lines
class bonus extends MovieClip
{
function bonus()
{
super();
_global.bonusez.push(this);
this.w = this._width / 2;
this.h = this._height / 2;
this.init = false;
this._alpha = 0;
trace("create bonus: " + this);
}
function initObj(t, s)
{
s = parseFloat(s);
if(_global.noSet(s))
{
return undefined;
}
this.type = t;
this.speedy = s;
this.init = true;
}
function onEnterFrame()
{
if(_global.gameInMoving)
{
if(this.init)
{
if(this._alpha < 100)
{
this._alpha += 10;
if(this._alpha > 100)
{
this._alpha = 100;
}
}
this._y += this.speedy;
if(this._y > 450)
{
this.removeFromArray();
this.removeMovieClip();
}
}
if(_global.gameInProcess)
{
if(this.hitTest(_global.player))
{
if(this.type != "bomb")
{
_global.sound.play("bonpick",this._x);
}
if(this.type == "triple")
{
var _loc4_ = _global.ballz[Math.floor(Math.random() * _global.ballz.length)];
if(_loc4_.type == "rocket" || _loc4_.type == "lazer" || _loc4_.type == "freeze")
{
}
var _loc8_ = Math.atan2(_loc4_.yspeed,_loc4_.xspeed);
var _loc6_ = _root.all.blz.attachMovie("ballContainer","ballMC" + _root.all.blz.getNextHighestDepth(),_root.all.blz.getNextHighestDepth());
var _loc7_ = _loc8_ - _global.envS.bonus_ball_ang / _global.PI2;
_loc6_.initObj("simpleBall",_loc4_.speedDefault * Math.cos(_loc7_),_loc4_.speedDefault * Math.sin(_loc7_));
_loc6_.moveTo(_loc4_._x,_loc4_._y);
_loc6_.setMode(_loc4_.mode,_loc4_.modeChangedTime,_loc4_.modeChangedMaxTime);
_loc6_.changeSpeed(_loc4_.speedRatio,_loc4_.speedChangedTime,_loc4_.speedChangedMaxTime);
_loc6_.changeDim(_loc4_.dimRatio,_loc4_.dimChangedTime,_loc4_.dimChangedMaxTime);
_loc6_.image._xscale = _loc6_.image._yscale = _loc4_.image._xscale;
_loc6_.inQueue(50);
_global.ballz.push(_loc6_);
_loc6_ = _root.all.blz.attachMovie("ballContainer","ballMC" + _root.all.blz.getNextHighestDepth(),_root.all.blz.getNextHighestDepth());
_loc7_ = _loc8_ + _global.envS.bonus_ball_ang / _global.PI2;
_loc6_.initObj("simpleBall",_loc4_.speedDefault * Math.cos(_loc7_),_loc4_.speedDefault * Math.sin(_loc7_));
_loc6_.moveTo(_loc4_._x,_loc4_._y);
_loc6_.setMode(_loc4_.mode,_loc4_.modeChangedTime,_loc4_.modeChangedMaxTime);
_loc6_.changeSpeed(_loc4_.speedRatio,_loc4_.speedChangedTime,_loc4_.speedChangedMaxTime);
_loc6_.changeDim(_loc4_.dimRatio,_loc4_.dimChangedTime,_loc4_.dimChangedMaxTime);
_loc6_.image._xscale = _loc6_.image._yscale = _loc4_.image._xscale;
_loc6_.inQueue(50);
_global.ballz.push(_loc6_);
}
else if(this.type == "live")
{
_global.changePlayerLives(1);
}
else if(this.type == "lazer" || this.type == "rocket" || this.type == "freeze")
{
_global.player.setMode(this.type,_global.envS[this.type + "Count"]);
}
else if(this.type == "acid" || this.type == "fire")
{
var _loc5_ = 0;
while(_loc5_ < _global.ballz.length)
{
_global.ballz[_loc5_].setMode(this.type);
_loc5_ = _loc5_ + 1;
}
}
else if(this.type == "glue")
{
_global.player.glued = true;
_global.player.gluedChangedTime = 0;
_global.player.gluedChangedMaxTime = _global.envS.glueTime;
_global.player.img.glue._visible = true;
}
else if(this.type == "slowball")
{
_loc5_ = 0;
while(_loc5_ < _global.ballz.length)
{
_global.ballz[_loc5_].changeSpeed(_global.envS.speedChangeDown);
_loc5_ = _loc5_ + 1;
}
}
else if(this.type == "fastball")
{
_loc5_ = 0;
while(_loc5_ < _global.ballz.length)
{
_global.ballz[_loc5_].changeSpeed(_global.envS.speedChangeUp);
_loc5_ = _loc5_ + 1;
}
}
else if(this.type == "bigball")
{
_loc5_ = 0;
while(_loc5_ < _global.ballz.length)
{
_global.ballz[_loc5_].changeDim(_global.envS.dimChangeUp);
_loc5_ = _loc5_ + 1;
}
}
else if(this.type == "littleball")
{
_loc5_ = 0;
while(_loc5_ < _global.ballz.length)
{
_global.ballz[_loc5_].changeDim(_global.envS.dimChangeDown);
_loc5_ = _loc5_ + 1;
}
}
else if(this.type == "widecaret")
{
_global.player.rchangeDim(_global.player_caret.maxWidth);
}
else if(this.type == "narrowcaret")
{
_global.player.rchangeDim(_global.player_caret.minWidth);
}
else if(this.type == "bomb")
{
_global.changePlayerLives(-1,true);
}
else if(this.type == "wall")
{
if(!_global.noSet(_global.wallTile))
{
_global.wallTile.decreaseLive(- _global.envS.wallBonusLives);
}
else
{
var _loc9_ = _root.all.top1.getNextHighestDepth();
_global.wallTile = _root.all.top1.attachMovie("tileMC","tt" + _loc9_,_loc9_);
_global.wallTile.makeTile("theWall");
_global.allTiles.unshift(_global.wallTile);
_global.wallTile.setInGame(0);
_global.wallTile.setLives(_global.envS.wallBonusLives);
_global.wallTile._x = 0;
_global.wallTile._y = _global.borders.bottom - 10;
_global.wallTile.initObj();
}
}
else if(this.type == "score")
{
_global.changeLevelScore(_global.envS.bonusScore);
}
this.removeFromArray();
this.removeMovieClip();
}
}
}
}
function removeFromArray()
{
var _loc3_ = 0;
while(_loc3_ < _global.bonusez.length)
{
if(_global.bonusez[_loc3_] == this)
{
_global.bonusez.splice(_loc3_,1);
return undefined;
}
_loc3_ = _loc3_ + 1;
}
}
}